package com.ostrich.cloud.ostrichBusinessWeb.client;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.ostrich.cloud.common.result.Result;
import com.ostrich.cloud.ostrichBusinessWeb.client.param.BusinessUpdateParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import java.io.IOException;
import java.util.Date;

@FeignClient(contextId = "usersWebClient",name="ostrichBusinessWeb")
@Api("商家相关接口")
public interface BusinessWebClient {
    @GetMapping("getBusiness")
    @ApiOperation("查询商家信息接口")
    public Result getBusiness();

    @GetMapping("getRiderByBusiness")
    @ApiOperation("根据商家查询骑手接口")
    public Result getRiderByBusiness(@RequestParam("current") Integer current,@RequestParam("size") Integer size,
                                     @RequestParam( value = "status" ,required = false) String status);

    @PostMapping("businessLogin")
    @ApiOperation("商家登录接口")
    public Result businessLogin(@RequestParam("username")String username,@RequestParam("password") String password);


    @PutMapping("putBusiness")
    @ApiOperation("修改商家个人信息接口")
    public Result putBusiness(@Valid BusinessUpdateParam param);

    @GetMapping("conditionsQuerySales")
    @ApiOperation("根据开始日期结束日期查询流水")
    public Result conditionsQuerySales(@RequestParam("startTime") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") Date startTime, @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")  @RequestParam("endTime")Date endTime,
                                       @RequestParam("current") Integer current, @RequestParam("size")Integer size);

    @PostMapping("upLoad")
    @ApiOperation("上傳圖片接口")
    public Result upLoad(@RequestBody MultipartFile file) throws IOException;
}
